package prototypePattern;

public class Main {
    public static void main(String[] args) throws CloneNotSupportedException {
        // 创建对象
        Apple apple = new Apple("red",100);
        // 克隆对象
        Apple apple2 = (Apple) apple.clone();
        // 修改克隆对象
        apple2.setColor("green");
        apple2.setWeight(200);
        System.out.println(apple == apple2);// false
        // 输出结果
        System.out.println("Original Apple: " + apple.getColor() + " " + apple.getWeight());
        System.out.println("Cloned Apple: " + apple2.getColor() + " " + apple2.getWeight());
        
    }
}
